POV-Ray : Newsgroups : povray.newusers : povray and 3D graphs : Re: povray and 3D graphs Server Time
28 Jul 2024 16:22:05 EDT (-0400)
  Re: povray and 3D graphs  
From: Warp
Date: 16 Apr 2008 21:34:04
Message: <4806a90b@news.povray.org>
Daniel C. Bastos <dba### [at] yahoocombr> wrote:
> Hi there. I'm interested in plotting some graphs in povray. I have been
> reading the documentation in the help file, but it is not going torwards
> telling me how to plot, say, x = cos(t), y = cos(t), z = t. Could
> someone point me in some direction where I can learn the basics of
> getting some parametric equations plotted?

  That depends a lot on what is it exactly that you want to plot.
Eg. plotting a surface is completely different from plotting a curve.
Your example seems to be a curve.

  There is no direct support for curves per se, but you can approximate
one by, for example, creating tiny cylinders along the curve, for example
like this:

#declare X = function(T) { sin(T) };
#declare Y = function(T) { cos(T) };
#declare Z = function(T) { T };

#declare CylRadius = .05;
#declare MinT = 0;
#declare MaxT = 2*pi;
#declare Steps = 100;

union
{ #declare Ind = 0;
  #while(Ind < Steps)
    #declare T1 = MinT + (MaxT-MinT)*Ind/Steps;
    #declare T2 = MinT + (MaxT-MinT)*(Ind+1)/Steps;
    #declare P1 = <X(T1), Y(T1), Z(T1)>;
    #declare P2 = <X(T2), Y(T2), Z(T2)>;
    sphere { P1, CylRadius }
    cylinder { P1, P2, CylRadius }
    #declare Ind = Ind+1;
  #end

  pigment { rgb x } finish { specular .5 }
}

camera { location -z*5 look_at 0 angle 35 }
light_source { <100, 200, -300>, 1 }
plane { y, -1.5 pigment { checker rgb 1, rgb .5 scale 10 } }


-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.